Spring Boot Persistence Best Practices by Anghel Leonard

Spring Boot Persistence Best Practices by Anghel Leonard

Author:Anghel Leonard
Language: eng
Format: epub
ISBN: 9781484256268
Publisher: Apress


@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

private Long id;

private int age;

private String name;

private String genre;

...

}

Now, let’s see how to retrieve the database auto-generated primary keys via getId(), JdbcTemplate, and SimpleJdbcInsert.

Retrieve Auto-Generated Keys via getId()

In JPA style, you can retrieve the auto-generated keys via getId() , as in the following example:public void insertAuthorGetAutoGeneratedKeyViaGetId() {

Author author = new Author();



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.